<?php

class Mobileapi_Model_BukkenTenpo extends Apm_Model_Base
{

    public function getTenpoList($code)
    {
        $sql = "select T03_TENPO_CD,T03_TENPO_NAME,T03_HEYA_CD,
                   T03_KASHIDASHI_KUBUN,T03_FREERENT_FLAG,T03_TEN_FREERENT_FLAG,T03_HEYAWARI_FLAG,T03_TEN_HEYAWARI_FLAG,T03_DAIHYO_FLG,
                   M05_TENPO_TEL01,M05_JYUUSHO_TEXT,M05_TENPO_BANCHI,M05_TENPO_JYUUSHO_BIKOU,
                   M05_TENPO_BANGOU,M05_EIGYOU_ZIKAN_OPEN_H,M05_EIGYOU_ZIKAN_OPEN_M,
                   M05_EIGYOU_ZIKAN_CLOSE_H,M05_EIGYOU_ZIKAN_CLOSE_M,
                   M05_KOUTSUU_TEXT01,M05_TOHO01,
                   M05_TEIKYUUBI,M05_TEIKYUUBI_BIKOU,T03_SHIKIKIN,T03_SHIKIKIN_TSUKISUU,T03_REIKIN,T03_REIKIN_TSUKISUU,
                   T03_TORIHIKI_TAIYOU,
                   M05_MENKYO_HAKKOUMOTO,M05_MENKYO_KOUSHINKAI,M05_MENKYO_GOUSUU";
        for ($call_no = 1; $call_no <= Apm_Config_Shop::CALLNOTE_NO_MAX; $call_no++)
        {
            $sql .= ",M93.M93_CONNECTION_NO" . $call_no;
            $sql .= ",M93.M93_CONTROL_FLAG" . $call_no;
        }
        $sql .= ",M93.M93_USE_KBN,M93.M93_START_DATE,M93.M93_DEL_DATE";
        $sql .= " from T03WEB_HEYA,M05TENPO_INFO,M93CALLNOTE M93
              where T03_KOUKAI_FLAG=1
                and T03_TENPO_CD=M05_TENPO_CD
                and T03_DAIHYO_HEYA_CD=" . $code . "
                and T03_TENPO_CD = M93.M93_TENPO_CD(+)
                group by T03_TENPO_CD,T03_TENPO_NAME,T03_HEYA_CD,
                         T03_KASHIDASHI_KUBUN,T03_FREERENT_FLAG,T03_TEN_FREERENT_FLAG,T03_HEYAWARI_FLAG,T03_TEN_HEYAWARI_FLAG,T03_DAIHYO_FLG,
                         M05_TENPO_TEL01,M05_JYUUSHO_TEXT,M05_TENPO_BANCHI,M05_TENPO_JYUUSHO_BIKOU,
                         M05_TENPO_BANGOU,M05_EIGYOU_ZIKAN_OPEN_H,M05_EIGYOU_ZIKAN_OPEN_M,
                   M05_EIGYOU_ZIKAN_CLOSE_H,M05_EIGYOU_ZIKAN_CLOSE_M,
                   M05_KOUTSUU_TEXT01,M05_TOHO01,
                   M05_TEIKYUUBI,M05_TEIKYUUBI_BIKOU,T03_SHIKIKIN,T03_SHIKIKIN_TSUKISUU,T03_REIKIN,T03_REIKIN_TSUKISUU,
                   T03_TORIHIKI_TAIYOU,
                   M05_MENKYO_HAKKOUMOTO,M05_MENKYO_KOUSHINKAI,M05_MENKYO_GOUSUU";
        for ($call_no = 1; $call_no <= Apm_Config_Shop::CALLNOTE_NO_MAX; $call_no++)
        {
            $sql .= ",M93.M93_CONNECTION_NO" . $call_no;
            $sql .= ",M93.M93_CONTROL_FLAG" . $call_no;
        }
        $sql .= ",M93.M93_USE_KBN,M93.M93_START_DATE,M93.M93_DEL_DATE";
        $sql .= "   order by min(T03_TENPO_HYOJI_YUSEN)";
        $list = $this->dbGetList($sql);

        $model_cam = new Mobileapi_Model_BukkenCampaign();
        $norm_cam = $model_cam->getNormalCampaigns();

        $img_base = 'http://img.apamanshop.com/fs/tenpoimg/';
        foreach ($list as $i => $tenpo)
        {
            $cd = $tenpo['T03_TENPO_CD'];
            $list[$i]['STUFF_IMG'] = $img_base . 's' . Apm_ShopUtil::getOldTenpoCd($cd) . '.jpg';
            $list[$i]['GAIKAN_IMG'] = $img_base . 'g' . Apm_ShopUtil::getOldTenpoCd($cd) . '.jpg';
            $list[$i]['TEIKYUUBI'] = $this->convertTeikyuubi($tenpo);
            $list[$i]['SHIKIKIN'] = Apm_Bukkenitems::GetShikikinStr($tenpo);
            $list[$i]['REIKIN'] = Apm_Bukkenitems::GetReikinStr($tenpo);

            $list[$i]['LINE_URL'] = Apm_Config_Shop::URL_LINE;
            $list[$i]['M05_TENPO_LINE_ID'] = Apm_ShopUtil::getTenpoLineId($cd);

            $heya_cam = $model_cam->getHeyaCampaigns($tenpo['T03_HEYA_CD']);
            $list[$i]['CAMPAIGNS'] = array_merge($heya_cam, $norm_cam);
        }
        return $list;
    }

    public function getTenpoListHeya($code)
    {
        $sql = "select T03_TENPO_CD,T03_TENPO_NAME,T03_HEYA_CD,
                   T03_KASHIDASHI_KUBUN,T03_FREERENT_FLAG,T03_TEN_FREERENT_FLAG,T03_HEYAWARI_FLAG,T03_TEN_HEYAWARI_FLAG,T03_DAIHYO_FLG,
                   M05_TENPO_TEL01,M05_JYUUSHO_TEXT,M05_TENPO_BANCHI,M05_TENPO_JYUUSHO_BIKOU,
                   M05_TENPO_BANGOU,M05_EIGYOU_ZIKAN_OPEN_H,M05_EIGYOU_ZIKAN_OPEN_M,
                   M05_EIGYOU_ZIKAN_CLOSE_H,M05_EIGYOU_ZIKAN_CLOSE_M,
                   M05_KOUTSUU_TEXT01,M05_TOHO01,
                   M05_TEIKYUUBI,M05_TEIKYUUBI_BIKOU,T03_SHIKIKIN,T03_SHIKIKIN_TSUKISUU,T03_REIKIN,T03_REIKIN_TSUKISUU,
                   T03_TORIHIKI_TAIYOU,
                   M05_MENKYO_HAKKOUMOTO,M05_MENKYO_KOUSHINKAI,M05_MENKYO_GOUSUU";
        for ($call_no = 1; $call_no <= Apm_Config_Shop::CALLNOTE_NO_MAX; $call_no++)
        {
            $sql .= ",M93.M93_CONNECTION_NO" . $call_no;
            $sql .= ",M93.M93_CONTROL_FLAG" . $call_no;
        }
        $sql .= ",M93.M93_USE_KBN,M93.M93_START_DATE,M93.M93_DEL_DATE";
        $sql .= " from T03WEB_HEYA,M05TENPO_INFO,M93CALLNOTE M93
              where T03_KOUKAI_FLAG=1
                and T03_TENPO_CD=M05_TENPO_CD
                and T03_HEYA_CD=" . $code . "
                and T03_TENPO_CD = M93.M93_TENPO_CD(+)
                group by T03_TENPO_CD,T03_TENPO_NAME,T03_HEYA_CD,
                         T03_KASHIDASHI_KUBUN,T03_FREERENT_FLAG,T03_TEN_FREERENT_FLAG,T03_HEYAWARI_FLAG,T03_TEN_HEYAWARI_FLAG,T03_DAIHYO_FLG,
                         M05_TENPO_TEL01,M05_JYUUSHO_TEXT,M05_TENPO_BANCHI,M05_TENPO_JYUUSHO_BIKOU,
                         M05_TENPO_BANGOU,M05_EIGYOU_ZIKAN_OPEN_H,M05_EIGYOU_ZIKAN_OPEN_M,
                   M05_EIGYOU_ZIKAN_CLOSE_H,M05_EIGYOU_ZIKAN_CLOSE_M,
                   M05_KOUTSUU_TEXT01,M05_TOHO01,
                   M05_TEIKYUUBI,M05_TEIKYUUBI_BIKOU,T03_SHIKIKIN,T03_SHIKIKIN_TSUKISUU,T03_REIKIN,T03_REIKIN_TSUKISUU,
                   T03_TORIHIKI_TAIYOU,
                   M05_MENKYO_HAKKOUMOTO,M05_MENKYO_KOUSHINKAI,M05_MENKYO_GOUSUU";
        for ($call_no = 1; $call_no <= Apm_Config_Shop::CALLNOTE_NO_MAX; $call_no++)
        {
            $sql .= ",M93.M93_CONNECTION_NO" . $call_no;
            $sql .= ",M93.M93_CONTROL_FLAG" . $call_no;
        }
        $sql .= ",M93.M93_USE_KBN,M93.M93_START_DATE,M93.M93_DEL_DATE";
        $sql .= "   order by min(T03_TENPO_HYOJI_YUSEN)";
        $list = $this->dbGetList($sql);

        $model_cam = new Mobileapi_Model_BukkenCampaign();
        $norm_cam = $model_cam->getNormalCampaigns();

        $img_base = 'http://img.apamanshop.com/fs/tenpoimg/';
        foreach ($list as $i => $tenpo)
        {
            $cd = $tenpo['T03_TENPO_CD'];
            $list[$i]['STUFF_IMG'] = $img_base . 's' . Apm_ShopUtil::getOldTenpoCd($cd) . '.jpg';
            $list[$i]['GAIKAN_IMG'] = $img_base . 'g' . Apm_ShopUtil::getOldTenpoCd($cd) . '.jpg';
            $list[$i]['TEIKYUUBI'] = $this->convertTeikyuubi($tenpo);
            $list[$i]['SHIKIKIN'] = Apm_Bukkenitems::GetShikikinStr($tenpo);
            $list[$i]['REIKIN'] = Apm_Bukkenitems::GetReikinStr($tenpo);

            $list[$i]['LINE_URL'] = Apm_Config_Shop::URL_LINE;
            $list[$i]['M05_TENPO_LINE_ID'] = Apm_ShopUtil::getTenpoLineId($cd);

            $heya_cam = $model_cam->getHeyaCampaigns($tenpo['T03_HEYA_CD']);
            $list[$i]['CAMPAIGNS'] = array_merge($heya_cam, $norm_cam);
        }
        return $list;
    }

    private function convertTeikyuubi($data)
    {
        $teikyubi = $data['M05_TEIKYUUBI'];
        // $teikyubiBikou = $data['M05_TEIKYUUBI_BIKOU'];
        $teikyubiName = '';

        $youbi = array(
            '月',
            '火',
            '水',
            '木',
            '金',
            '土',
            '日'
        );

        if ($teikyubi == '0000000' && $teikyubiBikou == '')
        {
            $teikyubiName = '-';
        }
        else
        {
            $array = array();
            for ($i = 0; $i < 7; $i++)
            {
                if (substr($teikyubi, $i, 1) == '1') $array[] = $youbi[$i] . '曜日'; // mb_convert_encoding($youbi[$i].'曜日','SJIS','UTF-8');
            }
            // if ($teikyubiBikou != '') $array[] = $teikyubiBikou;
            $teikyubiName = join(" ", $array);
        }
        return $teikyubiName;
    }

    // 建物店舗一覧取得
    public function getTatemonoTenpoList($code)
    {
        $sql = "select DISTINCT T03_TENPO_CD,T03_TENPO_NAME,
      			   --T03_TATEMONO_CD,
                   T03_KASHIDASHI_KUBUN,
      			   --T03_FREERENT_FLAG,T03_TEN_FREERENT_FLAG,T03_HEYAWARI_FLAG,T03_TEN_HEYAWARI_FLAG,T03_DAIHYO_FLG,
                   M05_TENPO_TEL01,M05_JYUUSHO_TEXT,M05_TENPO_BANCHI,M05_TENPO_JYUUSHO_BIKOU,
                   M05_TENPO_BANGOU,M05_EIGYOU_ZIKAN_OPEN_H,M05_EIGYOU_ZIKAN_OPEN_M,
                   M05_EIGYOU_ZIKAN_CLOSE_H,M05_EIGYOU_ZIKAN_CLOSE_M,
                   M05_KOUTSUU_TEXT01,M05_TOHO01,
                   M05_TEIKYUUBI,M05_TEIKYUUBI_BIKOU,T03_TORIHIKI_TAIYOU,
      			   --T03_SHIKIKIN,T03_SHIKIKIN_TSUKISUU,T03_REIKIN,T03_REIKIN_TSUKISUU,
                   --T03_HOSHOUKIN,T03_HOSHOUKIN_TSUKISUU,
                   M05_MENKYO_HAKKOUMOTO,M05_MENKYO_KOUSHINKAI,M05_MENKYO_GOUSUU";
        for ($call_no = 1; $call_no <= Apm_Config_Shop::CALLNOTE_NO_MAX; $call_no++)
        {
            $sql .= ",M93.M93_CONNECTION_NO" . $call_no;
            $sql .= ",M93.M93_CONTROL_FLAG" . $call_no;
        }
        $sql .= ",M93.M93_USE_KBN,M93.M93_START_DATE,M93.M93_DEL_DATE";
        $sql .= " from T03WEB_HEYA,M05TENPO_INFO,M93CALLNOTE M93
              where T03_KOUKAI_FLAG=1
                and T03_TENPO_CD=M05_TENPO_CD
                and T03_DAIHYO_TATEMONO_CD = " . $code . "
                and T03_TENPO_CD = M93.M93_TENPO_CD(+)
                group by T03_TENPO_CD,T03_TENPO_NAME,
                		--T03_TATEMONO_CD,
                         T03_KASHIDASHI_KUBUN,
                		--T03_FREERENT_FLAG,T03_TEN_FREERENT_FLAG,T03_HEYAWARI_FLAG,T03_TEN_HEYAWARI_FLAG,T03_DAIHYO_FLG,
                         M05_TENPO_TEL01,M05_JYUUSHO_TEXT,M05_TENPO_BANCHI,M05_TENPO_JYUUSHO_BIKOU,
                         M05_TENPO_BANGOU,M05_EIGYOU_ZIKAN_OPEN_H,M05_EIGYOU_ZIKAN_OPEN_M,
                   M05_EIGYOU_ZIKAN_CLOSE_H,M05_EIGYOU_ZIKAN_CLOSE_M,
                   M05_KOUTSUU_TEXT01,M05_TOHO01,
                   M05_TEIKYUUBI,M05_TEIKYUUBI_BIKOU,T03_TORIHIKI_TAIYOU,
                   --T03_SHIKIKIN,T03_SHIKIKIN_TSUKISUU,T03_REIKIN,T03_REIKIN_TSUKISUU,
                   --T03_HOSHOUKIN,T03_HOSHOUKIN_TSUKISUU,
                   M05_MENKYO_HAKKOUMOTO,M05_MENKYO_KOUSHINKAI,M05_MENKYO_GOUSUU";
        for ($call_no = 1; $call_no <= Apm_Config_Shop::CALLNOTE_NO_MAX; $call_no++)
        {
            $sql .= ",M93.M93_CONNECTION_NO" . $call_no;
            $sql .= ",M93.M93_CONTROL_FLAG" . $call_no;
        }
        $sql .= ",M93.M93_USE_KBN,M93.M93_START_DATE,M93.M93_DEL_DATE";
        // $sql .= " order by min(T03_TENPO_HYOJI_YUSEN)";

        $list = $this->dbGetList($sql);

        $img_base = 'http://img.apamanshop.com/fs/tenpoimg/';
        foreach ($list as $i => $tenpo)
        {
            $cd = $tenpo['T03_TENPO_CD'];
            $list[$i]['STUFF_IMG'] = $img_base . 's' . Apm_ShopUtil::getOldTenpoCd($cd) . '.jpg';
            $list[$i]['GAIKAN_IMG'] = $img_base . 'g' . Apm_ShopUtil::getOldTenpoCd($cd) . '.jpg';
            $list[$i]['TEIKYUUBI'] = $this->convertTeikyuubi($tenpo);
            $list[$i]['SHIKIKIN'] = Apm_Bukkenitems::GetShikikinStr($tenpo);
            $list[$i]['REIKIN'] = Apm_Bukkenitems::GetReikinStr($tenpo);
            $list[$i]['HOSHOUKIN'] = Apm_Bukkenitems::GetHoshoukinStr($tenpo);

            $list[$i]['LINE_URL'] = Apm_Config_Shop::URL_LINE;
            $list[$i]['M05_TENPO_LINE_ID'] = Apm_ShopUtil::getTenpoLineId($cd);
        }
        return $list;
    }

    // 建物店舗一覧取得
    public function getTenpoListTatemono($code)
    {
        $sql = "select T03_TENPO_CD,T03_TENPO_NAME,T03_TATEMONO_CD,
                   T03_KASHIDASHI_KUBUN,T03_FREERENT_FLAG,T03_TEN_FREERENT_FLAG,T03_HEYAWARI_FLAG,T03_TEN_HEYAWARI_FLAG,T03_DAIHYO_FLG,
                   M05_TENPO_TEL01,M05_JYUUSHO_TEXT,M05_TENPO_BANCHI,M05_TENPO_JYUUSHO_BIKOU,
                   M05_TENPO_BANGOU,M05_EIGYOU_ZIKAN_OPEN_H,M05_EIGYOU_ZIKAN_OPEN_M,
                   M05_EIGYOU_ZIKAN_CLOSE_H,M05_EIGYOU_ZIKAN_CLOSE_M,
                   M05_KOUTSUU_TEXT01,M05_TOHO01,
                   M05_TEIKYUUBI,M05_TEIKYUUBI_BIKOU,T03_SHIKIKIN,T03_SHIKIKIN_TSUKISUU,T03_REIKIN,T03_REIKIN_TSUKISUU,
                   T03_HOSHOUKIN,T03_HOSHOUKIN_TSUKISUU,
                   M05_MENKYO_HAKKOUMOTO,M05_MENKYO_KOUSHINKAI,M05_MENKYO_GOUSUU";
        for ($call_no = 1; $call_no <= Apm_Config_Shop::CALLNOTE_NO_MAX; $call_no++)
        {
            $sql .= ",M93.M93_CONNECTION_NO" . $call_no;
            $sql .= ",M93.M93_CONTROL_FLAG" . $call_no;
        }
        $sql .= ",M93.M93_USE_KBN,M93.M93_START_DATE,M93.M93_DEL_DATE";
        $sql .= " from T03WEB_HEYA,M05TENPO_INFO,M93CALLNOTE M93
              where T03_KOUKAI_FLAG=1
                and T03_TENPO_CD=M05_TENPO_CD
                and T03_TATEMONO_CD = " . $code . "
                and T03_TENPO_CD = M93.M93_TENPO_CD(+)
                group by T03_TENPO_CD,T03_TENPO_NAME,T03_TATEMONO_CD,
                         T03_KASHIDASHI_KUBUN,T03_FREERENT_FLAG,T03_TEN_FREERENT_FLAG,T03_HEYAWARI_FLAG,T03_TEN_HEYAWARI_FLAG,T03_DAIHYO_FLG,
                         M05_TENPO_TEL01,M05_JYUUSHO_TEXT,M05_TENPO_BANCHI,M05_TENPO_JYUUSHO_BIKOU,
                         M05_TENPO_BANGOU,M05_EIGYOU_ZIKAN_OPEN_H,M05_EIGYOU_ZIKAN_OPEN_M,
                   M05_EIGYOU_ZIKAN_CLOSE_H,M05_EIGYOU_ZIKAN_CLOSE_M,
                   M05_KOUTSUU_TEXT01,M05_TOHO01,
                   M05_TEIKYUUBI,M05_TEIKYUUBI_BIKOU,T03_SHIKIKIN,T03_SHIKIKIN_TSUKISUU,T03_REIKIN,T03_REIKIN_TSUKISUU,
                   T03_HOSHOUKIN,T03_HOSHOUKIN_TSUKISUU,
                   M05_MENKYO_HAKKOUMOTO,M05_MENKYO_KOUSHINKAI,M05_MENKYO_GOUSUU";
        for ($call_no = 1; $call_no <= Apm_Config_Shop::CALLNOTE_NO_MAX; $call_no++)
        {
            $sql .= ",M93.M93_CONNECTION_NO" . $call_no;
            $sql .= ",M93.M93_CONTROL_FLAG" . $call_no;
        }
        $sql .= ",M93.M93_USE_KBN,M93.M93_START_DATE,M93.M93_DEL_DATE";
        $sql .= "   order by min(T03_TENPO_HYOJI_YUSEN)";
        $list = $this->dbGetList($sql);

        $img_base = 'http://img.apamanshop.com/fs/tenpoimg/';
        foreach ($list as $i => $tenpo)
        {
            $cd = $tenpo['T03_TENPO_CD'];
            $list[$i]['STUFF_IMG'] = $img_base . 's' . Apm_ShopUtil::getOldTenpoCd($cd) . '.jpg';
            $list[$i]['GAIKAN_IMG'] = $img_base . 'g' . Apm_ShopUtil::getOldTenpoCd($cd) . '.jpg';
            $list[$i]['TEIKYUUBI'] = $this->convertTeikyuubi($tenpo);
            $list[$i]['SHIKIKIN'] = Apm_Bukkenitems::GetShikikinStr($tenpo);
            $list[$i]['REIKIN'] = Apm_Bukkenitems::GetReikinStr($tenpo);
            $list[$i]['HOSHOUKIN'] = Apm_Bukkenitems::GetHoshoukinStr($tenpo);

            $list[$i]['LINE_URL'] = Apm_Config_Shop::URL_LINE;
            $list[$i]['M05_TENPO_LINE_ID'] = Apm_ShopUtil::getTenpoLineId($cd);
        }
        return $list;
    }

    // 店舗CDで建物一覧を取得
    public function getTatemonoListByTenpoCD($tenpoCD)
    {
        $sql = "select
			T03_HEYA_CD,
            T03_TATEMONO_NAME,
            T03_TATEMONO_TYPE,
            (SELECT M01_SHIKUCHOUSON FROM M01JYUUSHO WHERE M01_TODOUFUKEN_CD = T03.T03_TODOUFUKEN_CD AND M01_SHIKUCHOUSON_CD = T03.T03_SHIKUCHOUSON_CD AND rownum = 1) AS T03_SHIKUCHOUSON_NAME_JP,
            T03_YACHIN,
            T03_YACHIN_TAX,
            T03_KYOUEKIHI,
            T03_KYOUEKIHI_TAX,
            T03_KANRIHI,
            T03_KANRIHI_TAX,
            T03_SHIKIKIN_TSUKISUU,
            T03_SHIKIKIN,
            T03_REIKIN_TSUKISUU,
            T03_REIKIN,
            T03_MADORI,
            T03_SENYUU_MENSEKI,
            T03_TENPO_CD,
            T03_ORIGINAL_TATEMONO_CD01,
            T03_TODOUFUKEN_CD,
            T03_SHIKUCHOUSON_CD,
            T03_CHOUMEI_CD,
            T03_MADORIZU_COMMON,
            T03_MADORIZU,
  			T03_HOUGAKU
		from
			T03WEB_HEYA T03
		where
			T03.T03_KOUKAI_FLAG		=	1
		   AND
		   T03.T03_TENPO_CD	= '" . $tenpoCD . "'
		   and
		   rownum <= 9
		order by
		   T03_KOUSHINBI DESC
		";

        $list = $this->dbGetList($sql);
        // OEM判定
        // $OemFlg = ((array_key_exists('OemCd', $params) == true) && (is_null($params['OemCd']) ==
        // false) && (is_numeric($params['OemCd']) == true));

        foreach ($list as $i => $tatemn)
        {
            $list[$i]['T03_YACHIN_STR'] = Apm_Bukkenitems::GetChinryouStr($list[$i]);
            $list[$i]['T03_KANRI_KYOEKI_STR'] = Apm_Bukkenitems::GetKyouekihiStr($list[$i], 0);
            $list[$i]['T03_SHIKIKIN_STR'] = Apm_Bukkenitems::GetShikikinStr($list[$i]); // 敷金
            $list[$i]['T03_REIKIN_STR'] = Apm_Bukkenitems::GetReikinStr($list[$i]);
            $list[$i]['T03_MADORI_STR'] = Apm_Bukkenitems::GetMadoriStr($list[$i]); // 間取り
            $list[$i]['T03_SENYUU_MENSEKI_STR'] = Apm_Bukkenitems::GetSenyuuMensekiStr($list[$i]);
            // 部屋向き
            $list[$i]['CONVERT_T03_HOUGAKU'] = Apm_Bukkenitems::GetHeyamukiStr($list[$i]);

            // 間取り図
            $OemFlg = true;
            $madoriGazou = Apm_Bukkenitems::GetImageData($list[$i], Apm_Config_Search::IMG_TYPE_MADORIZU, $OemFlg);

            if (count($madoriGazou) == 0)
            {
                $OemFlg = false;
                $madoriGazou = Apm_Bukkenitems::GetImageData($list[$i], Apm_Config_Search::IMG_TYPE_MADORIZU, $OemFlg);
            }

            $list[$i]['T03_IMAGE_DATA'][Apm_Config_Search::IMG_TYPE_MADORIZU] = $madoriGazou;
        }

        return $list;
    }

}
